package com.gc.server.vo.down;


import lombok.Data;

import java.util.Date;

import com.alibaba.excel.annotation.*;

import java.io.Serializable;


import com.gc.server.entity.ShopEntity;
import com.gc.server.vo.ShopVo;

import com.gc.server.enums.ShopTypeEnum;

/**
 * 药店实体
 * 表名 shop
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Fri Oct 16 18:10:43 CST 2020
 */
@Data
public class ShopDown implements Serializable {
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

    //
    @ExcelProperty("")
    private Long id;

    //编号
    @ExcelProperty("编号")
    private String code;

    //连锁编号
    @ExcelProperty("连锁编号")
    private String linkCode;

    //店名
    @ExcelProperty("简称")
    private String shopName;

    //店名
    @ExcelProperty("级别")
    private String level;

    //简称
    @ExcelProperty("店名")
    private String nickName;

    //ENUM-状态:"DIRECT-直营","JOIN-加盟"
    @ExcelIgnore
    private Integer type;
    @ExcelProperty("类型")
    private String typeStr;

    //省
    @ExcelProperty("省")
    private String province;

    //市
    @ExcelProperty("市")
    private String city;

    //县
    @ExcelProperty("县")
    private String county;

    //详细地址
    @ExcelProperty("详细地址")
    private String detail;

    //总部
    @ExcelProperty("总部")
    private String headCode;

    //备注
    @ExcelProperty("备注")
    private String remark;

    @ExcelProperty("创建时间")
    private Date date;


    public ShopDown() {

    }

    public ShopDown(ShopVo vo) {
        ShopEntity entity = vo.getEntity();
        this.setId(entity.getId());

        this.setCode(entity.getCode());

        this.setDate(entity.getDate());

        this.setLinkCode(entity.getLinkCode());

        this.setShopName(entity.getShopName());
        this.setLevel(entity.getLevel());

        this.setNickName(entity.getNickName());

        this.setType(entity.getType());
        if (entity.getType() != null) {
            this.setTypeStr(ShopTypeEnum.indexOf(entity.getType()));
        }

        this.setProvince(entity.getProvince());

        this.setCity(entity.getCity());

        this.setCounty(entity.getCounty());

        this.setDetail(entity.getDetail());

        if(vo.getHead()!=null){
            this.setHeadCode(vo.getHead().getCode());
        }

        this.setRemark(entity.getRemark());

    }

    public static void main(String[] args) {
        System.out.println(ShopTypeEnum.nameOf("加盟"));
    }


}
